package com.hunter.api.help.exception;

import com.hunter.api.help.result.BusinessCode;

/**
 * 业务异常，在hsf接口会被拦截
 *
 * @author Created by lfan on 2020/6/22 16:50
 */
public class BusinessException extends RuntimeException {


    private String code;
    private String message;

    public BusinessException(BusinessCode businessCode) {
        super(businessCode.getMessage());
        this.code = businessCode.getCode();
        this.message = businessCode.getMessage();
    }

    /**
     * 推荐使用上面的一个
     *
     * @param code
     * @param message
     */
    @Deprecated
    public BusinessException(String code, String message) {
        super(message);
        this.message = message;
        this.code = code;
    }

    public String getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }

}